package com.pzh.assignment.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import java.io.Serializable;
import java.time.LocalDateTime;

import com.pzh.assignment.common.bean.param.TaskParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

/**
 * <p>
 * 
 * </p>
 *
 * @author pengzhihao
 * @since 2022-04-16
 */
@Getter
@Setter
@ApiModel(value = "Task对象", description = "")
public class Task implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("教学任务id")
      @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty("外键：教师用户id")
    private Integer teacherId;

    @ApiModelProperty("外键：教学计划id")
    private Integer planId;

    @ApiModelProperty("是否合班：0 否，1 是")
    private Integer merge;

    @ApiModelProperty("教学班实际人数")
    private Integer actualNum;

    @ApiModelProperty("最大人数")
    private Integer maxNum;

    @ApiModelProperty("标准人数")
    private Integer commonNum;

      @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

      @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    @TableLogic
    private Integer deleted;


    public static Task valueOf(TaskParam param) {
        Task task = new Task();
        task.setId(param.getId());
        task.setTeacherId(param.getTeacherId());
        task.setPlanId(param.getPlanId());
        task.setActualNum(param.getActualNum());
        task.setCommonNum(param.getCommonNum());
        task.setMaxNum(param.getMaxNum());
        return task;
    }
}
